package edu.kjxy.day01.t13_1;

/**
 * 功能:
 * 作者:程序员欧阳子韩
 * 日期:2024/1/31 20:18
 */
public class MyThread extends Thread {
    @Override
    public void run() {
        super.run();
        try {
            for (int i = 0; i < 500000; i++) {
                if (this.interrupted()) {
                    System.out.println("已经是停止状态了!我要退出了！");
                    throw new InterruptedException();
                }
                System.out.println("i=" + i + 1);
            }
            System.out.println("我在for下面");
        } catch (InterruptedException e) {
            System.out.println("进入MyThread.java类run方法中的catch了！");
            e.printStackTrace();
        }
    }
}
